$(function() {
	selectAll();
	$("#search_btn").click(function() {
		$("#search_form").submit();
	}).mouseover(function() {
		$(this).css("cursor","pointer");
	});
	
	$("#link_ul li").each(function() {
		$(this).click(function() {
			$("#moreList").attr("title",1);
			$(this).addClass("on").siblings().removeClass("on");
		});
	});
	
	$("#search_person").click(function() {
		$("#search_content").load(window.getBaseURL()+"search/listPersons",{'key':window.keyword});
	})
	
	$("#search_team").click(function() {
		$("#search_content").load(window.getBaseURL()+"search/listTeams",{'key':window.keyword});
	})
	
	$("#search_all").click(function() {
		$("#search_content").empty();
		selectAll();
	});
	
})

function selectAll() {
	$.ajax({
		type:"POST",
		url:window.getBaseURL()+"search/listPersons",
		data:"key="+window.keyword,
		success:function(data) {
			$("#search_content").append(data);
		}
	});
	$.ajax({
		type:"POST",
		url:window.getBaseURL()+"search/listTeams",
		data:"key="+window.keyword,
		success:function(data) {
			$("#search_content").append(data);
		}
	});
}